<?php
namespace app\api\model;


use app\model\Base;

class MerchantInfo extends Base
{
    public function getVideoFormatAttr($value, $data)
    {
        return $this::getOssUrl() . $data['video_url'];
    }

    public function getLogoFormatAttr($value, $data)
    {
        return $this::getOssUrl() . $data['logo'];
    }

    public function getLicenseFormatAttr($value, $data)
    {
        return $this::getOssUrl() . $data['license'];
    }

    public function getRecProduct($limit = 6)
    {
        return self::
//            ->field('state, show, nav_id, cover, id, name')->with(['sku_price'])
            where('status', 1)
//            ->where('show', 'show')
//            ->where('nav_id', 3)
//            ->orderRaw("rand() , id DESC")
            ->limit($limit)
            ->append(['logo_format'])
            ->select();
    }
}